import { createRouter, createWebHistory } from 'vue-router'
// import HomeView from '../views/HomeView.vue'
import Layout from '@/views/layout/index.vue'
const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: '/',
      name: 'home',
      component: Layout,
      redirect: '/index',
      children: [
        {
          path: '/index',
          component: () => import('@/views/article/index.vue')
        },

        {
          path: '/like',
          component: () => import('@/views/like/index.vue')
        },
        {
          path: '/collect',
          component: () => import('@/views/collect/index.vue')
        },
        {
          path: '/my',
          component: () => import('@/views/my/index.vue')
        }
      ]
    },
    {
      path: '/login',
      name: 'login',
      component: () => import('@/views/login/index.vue')
    },
    {
      path: '/register',
      name: 'register',
      component: () => import('@/views/register/index.vue')
    },
    {
      path: '/article/:id',
      name: 'detail',
      component: () => import('@/views/detail/index.vue')
    }
  ]
})

export default router
